package cn.blog.dao.back;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import cn.blog.dao.conn.DataManager;
import cn.blog.dao.conn.ParamSet;
import cn.blog.dao.conn.RowDatas;
import cn.blog.entity.origin.Employee;

/**
 *后台员工登录Dao层
 * 
 * @author zjk
 *
 */
public class EmplyeeDao extends DataManager {
	private RowDatas<Employee> employee;// 后台管理员对象

	/**
	 * 无参构造，初始化
	 */
	public EmplyeeDao(){
		employee = new EmplyeeData();
	
	}
	/**
	 * 1.根据管理员账号查询其信息
	 * @param id
	 * @return
	 */
	public List<Employee> getemployee(String accont){
		String sql = "SELECT * from tb_managepeople WHERE mana_account=?";
		return queryList(sql, new ParamSet(accont),employee);
	}
	/**
	 * 获取管理员数据
	 * @author zjk
	 *
	 */
	public class EmplyeeData implements RowDatas<Employee>{

		@Override
		public Employee getRowData(ResultSet rs) throws SQLException {
			Employee emp = new Employee();
			emp.setEmpId(rs.getString(1));
			emp.setEmpAccount(rs.getString(2));
			emp.setEmpName(rs.getString(3));
			emp.setEmpPassword(rs.getString(4));
			return emp;
		}
		
	}
}
